//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.propertie;

import java.awt.*;
import javax.swing.*;
import org.jpgolay.me.Messages;

public class PropertyGUI extends JFrame {

    public PropertyGUI() {
        initComponents();
    }

    private void initComponents() {
        buttonGroup1 = new ButtonGroup();
        FlowLayout flowLayout1 = new FlowLayout();
        mainP = new JPanel();
        mainFieldsP = new JPanel();
        serialL = new JLabel();
        serial = new JTextField();
        ipL = new JLabel();
        ip = new JTextField();
        dbHomeL = new JLabel();
        dbHome = new JTextField();
        dbBackupL = new JLabel();
        dbBackup = new JTextField();
        adminUserL = new JLabel();
        adminUser = new JTextField();
        adminPassL = new JLabel();
        adminPass = new JTextField();
        adminUrlL = new JLabel();
        adminUrl = new JTextField();
        wiUserL = new JLabel();
        wiUser = new JTextField();
        wiPassL = new JLabel();
        wiPass = new JTextField();
        wiUrlL = new JLabel();
        wiUrl = new JTextField();
        dbDriverL = new JLabel();
        dbDriver = new JTextField();
        dbNewL = new JLabel();
        dbRemoveL = new JLabel();
        dbNew = new JCheckBox();
        dbRemove = new JCheckBox();
        actionP = new JPanel();
        okB = new JButton();
        cancelB = new JButton();
        setTitle(Messages.getString("PropertyGUI.welcome_title"));
        mainP.setLayout(new BorderLayout());
        mainFieldsP.setLayout(flowLayout1);
        serialL.setText(Messages.getString("PropertyGUI.SN"));
        serialL.setPreferredSize(new Dimension(150, 20));
        serial.setHorizontalAlignment(0);
        serial.setToolTipText(Messages.getString("PropertyGUI.serial_number"));
        serial.setPreferredSize(new Dimension(300, 20));
        ipL.setText(Messages.getString("PropertyGUI.IP_server"));
        ipL.setPreferredSize(new Dimension(150, 20));
        ip.setHorizontalAlignment(0);
        ip.setToolTipText(Messages.getString("PropertyGUI.ip_address"));
        ip.setPreferredSize(new Dimension(300, 20));
        dbHomeL.setText("DB Name");
        dbHomeL.setPreferredSize(new Dimension(150, 20));
        dbHome.setToolTipText(Messages.getString("PropertyGUI.backup_directory_tip"));
        dbHome.setPreferredSize(new Dimension(300, 20));
        dbBackupL.setText(Messages.getString("PropertyGUI.DB_Backup"));
        dbBackupL.setPreferredSize(new Dimension(150, 20));
        dbBackup.setToolTipText(Messages.getString("PropertyGUI.backup_directory"));
        dbBackup.setPreferredSize(new Dimension(300, 20));
        adminUserL.setForeground(new Color(204, 0, 51));
        adminUserL.setText(Messages.getString("PropertyGUI.DB_user_admin"));
        adminUserL.setPreferredSize(new Dimension(150, 20));
        adminUser.setForeground(new Color(204, 0, 51));
        adminUser.setToolTipText(Messages.getString("PropertyGUI.used_for_install"));
        adminUser.setPreferredSize(new Dimension(300, 20));
        adminPassL.setForeground(new Color(204, 0, 51));
        adminPassL.setText(Messages.getString("PropertyGUI.DB_pass_admin"));
        adminPassL.setPreferredSize(new Dimension(150, 20));
        adminPass.setForeground(new Color(204, 0, 51));
        adminPass.setToolTipText(Messages.getString("PropertyGUI.used_for_install"));
        adminPass.setPreferredSize(new Dimension(300, 20));
        adminUrlL.setForeground(new Color(204, 0, 51));
        adminUrlL.setText(Messages.getString("PropertyGUI.DB_url_admin"));
        adminUrlL.setPreferredSize(new Dimension(150, 20));
        adminUrl.setForeground(new Color(204, 0, 51));
        adminUrl.setToolTipText(Messages.getString("PropertyGUI.used_for_install"));
        adminUrl.setPreferredSize(new Dimension(300, 20));
        wiUserL.setForeground(new Color(0, 51, 204));
        wiUserL.setText(Messages.getString("PropertyGUI.DB_user_me"));
        wiUserL.setPreferredSize(new Dimension(150, 20));
        wiUser.setForeground(new Color(0, 51, 204));
        wiUser.setToolTipText(Messages.getString("PropertyGUI.username_for_me"));
        wiUser.setPreferredSize(new Dimension(300, 20));
        wiPassL.setForeground(new Color(0, 51, 204));
        wiPassL.setText(Messages.getString("PropertyGUI.DB_pass_me"));
        wiPassL.setPreferredSize(new Dimension(150, 20));
        wiPass.setForeground(new Color(0, 51, 204));
        wiPass.setToolTipText(Messages.getString("PropertyGUI.password_for_me"));
        wiPass.setPreferredSize(new Dimension(300, 20));
        wiUrlL.setForeground(new Color(0, 51, 204));
        wiUrlL.setText(Messages.getString("PropertyGUI.DB_url_me"));
        wiUrlL.setPreferredSize(new Dimension(150, 20));
        wiUrl.setForeground(new Color(0, 51, 204));
        wiUrl.setToolTipText(Messages.getString("PropertyGUI.url_for_mysql_server"));
        wiUrl.setPreferredSize(new Dimension(300, 20));
        dbDriverL.setForeground(new Color(51, 102, 0));
        dbDriverL.setText(Messages.getString("PropertyGUI.DB_driver"));
        dbDriverL.setPreferredSize(new Dimension(150, 20));
        dbDriver.setForeground(new Color(51, 102, 0));
        dbDriver.setToolTipText(Messages.getString("PropertyGUI.JDBC_driver"));
        dbDriver.setPreferredSize(new Dimension(300, 20));
        dbNewL.setText(Messages.getString("PropertyGUI.DB_install"));
        dbNewL.setForeground(Color.red);
        dbNewL.setPreferredSize(new Dimension(150, 20));
        dbRemoveL.setText(Messages.getString("PropertyGUI.DB_remove"));
        dbRemoveL.setForeground(Color.red);
        dbRemoveL.setPreferredSize(new Dimension(150, 20));
        dbNew.setText("WARNING Used just for the first installation !");
        dbNew.setToolTipText(Messages.getString("PropertyGUI.admin_warning"));
        dbNew.setForeground(Color.red);
        dbNew.setPreferredSize(new Dimension(300, 20));
        buttonGroup1.add(dbNew);
        dbRemove.setText(Messages.getString("PropertyGUI.data_warning"));
        dbRemove.setToolTipText(Messages.getString("PropertyGUI.admin_warning_msg"));
        dbRemove.setForeground(Color.red);
        dbRemove.setPreferredSize(new Dimension(300, 20));
        buttonGroup1.add(dbRemove);
        getContentPane().add(mainP, "Center");
        okB.setText(Messages.getString("PropertyGUI.OK"));
        okB.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/me/images/red12x12.png")));
        actionP.add(okB);
        cancelB.setText(Messages.getString("PropertyGUI.CANCEL"));
        cancelB.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/me/images/green12x12.png")));
        mainFieldsP.setPreferredSize(new Dimension(450, 262));
        setSize(460, 344);
        setContentPane(mainP);
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/jpgolay/me/images/orange.png")));
        setResizable(false);
        flowLayout1.setHgap(1);
        flowLayout1.setVgap(1);
        mainP.add(mainFieldsP, "Center");
        mainFieldsP.add(serialL, null);
        actionP.add(cancelB);
        mainP.add(actionP, "South");
        mainFieldsP.add(serial, null);
        mainFieldsP.add(ipL, null);
        mainFieldsP.add(ip, null);
        mainFieldsP.add(dbHomeL, null);
        mainFieldsP.add(dbHome, null);
        mainFieldsP.add(dbBackupL, null);
        mainFieldsP.add(dbBackup, null);
        mainFieldsP.add(adminUserL, null);
        mainFieldsP.add(adminUser, null);
        mainFieldsP.add(adminPassL, null);
        mainFieldsP.add(adminPass, null);
        mainFieldsP.add(adminUrlL, null);
        mainFieldsP.add(adminUrl, null);
        mainFieldsP.add(wiUserL, null);
        mainFieldsP.add(wiUser, null);
        mainFieldsP.add(wiPassL, null);
        mainFieldsP.add(wiPass, null);
        mainFieldsP.add(wiUrlL, null);
        mainFieldsP.add(wiUrl, null);
        mainFieldsP.add(dbDriverL, null);
        mainFieldsP.add(dbDriver, null);
        mainFieldsP.add(dbNewL, null);
        mainFieldsP.add(dbNew, null);
        mainFieldsP.add(dbRemoveL, null);
        mainFieldsP.add(dbRemove, null);
        getContentPane().add(actionP, "South");
        pack();
    }

    public String getAdminPass() {
        return adminPass.getText();
    }

    public String getAdminUrl() {
        return adminUrl.getText();
    }

    public String getAdminUser() {
        return adminUser.getText();
    }

    public JButton getCancelB() {
        return cancelB;
    }

    public String getDbBackup() {
        return dbBackup.getText();
    }

    public String getDbDriver() {
        return dbDriver.getText();
    }

    public String getDbHome() {
        return dbHome.getText();
    }

    public boolean isDbNew() {
        return dbNew.isSelected();
    }

    public boolean isDbRemove() {
        return dbRemove.isSelected();
    }

    public String getIp() {
        return ip.getText();
    }

    public JButton getOkB() {
        return okB;
    }

    public String getSerial() {
        return serial.getText();
    }

    public String getWiPass() {
        return wiPass.getText();
    }

    public String getWiUrl() {
        return wiUrl.getText();
    }

    public String getWiUser() {
        return wiUser.getText();
    }

    public void setAdminPass(String field) {
        adminPass.setText(field);
    }

    public void setAdminUrl(String field) {
        adminUrl.setText(field);
    }

    public void setAdminUser(String field) {
        adminUser.setText(field);
    }

    public void setDbBackup(String field) {
        dbBackup.setText(field);
    }

    public void setDbDriver(String field) {
        dbDriver.setText(field);
    }

    public void setDbHome(String field) {
        dbHome.setText(field);
    }

    public void setIp(String field) {
        ip.setText(field);
    }

    public void setSerial(String field) {
        serial.setText(field);
    }

    public void setWiPass(String field) {
        wiPass.setText(field);
    }

    public void setWiUrl(String field) {
        wiUrl.setText(field);
    }

    public void setWiUser(String field) {
        wiUser.setText(field);
    }
    private JPanel actionP;
    private JTextField adminPass;
    private JLabel adminPassL;
    private JTextField adminUrl;
    private JLabel adminUrlL;
    private JTextField adminUser;
    private JLabel adminUserL;
    private ButtonGroup buttonGroup1;
    private JButton cancelB;
    private JTextField dbBackup;
    private JLabel dbBackupL;
    private JTextField dbDriver;
    private JLabel dbDriverL;
    private JTextField dbHome;
    private JLabel dbHomeL;
    private JCheckBox dbNew;
    private JLabel dbNewL;
    private JCheckBox dbRemove;
    private JLabel dbRemoveL;
    private JTextField ip;
    private JLabel ipL;
    private JPanel mainFieldsP;
    private JPanel mainP;
    private JButton okB;
    private JTextField serial;
    private JLabel serialL;
    private JTextField wiPass;
    private JLabel wiPassL;
    private JTextField wiUrl;
    private JLabel wiUrlL;
    private JTextField wiUser;
    private JLabel wiUserL;
}
